package com.fr.report.script.function;

import com.fr.report.script.Function;
import com.fr.report.script.Function.Type;
import com.fr.report.script.NormalFunction;
import com.fr.report.script.Primitive;

public class LEN extends NormalFunction
{
  public Object run(Object[] paramArrayOfObject)
  {
    if (paramArrayOfObject.length < 1)
      return Primitive.ERROR_NAME;
    Object localObject = paramArrayOfObject[0];
    if (localObject != null)
      return new Integer("" + localObject.length());
    return new Integer(0);
  }

  public Function.Type getType()
  {
    return Function.TEXT;
  }

  public String getCN()
  {
    return "LEN(text): 返回文本串中的字符数。\nText:需要求其长度的文本，空格也计为字符。\n示例:\nLEN(\"Evermore software\")等于17。\nLEN(\" \")等于1。";
  }

  public String getEN()
  {
    return "LEN(text): LEN returns the number of characters in a text string.\nText is the text whose length you want to find. Spaces count as characters.\n\nExample:\n   LEN(\"Evermore software\") = 17\n   LEN(\" \") = 1";
  }
}